package com.kemai.designmode.ui
import android.os.Bundle
import com.kemai.common.adapter.ItemClickListener
import com.kemai.common.ui.BaseActivity
import com.kemai.designmode.R
import com.kemai.designmode.bridge.bag.BagAbstract
import com.kemai.designmode.bridge.bag.BigBag
import com.kemai.designmode.bridge.bag.MediumBag
import com.kemai.designmode.bridge.bag.SmallBag

//桥接模式模式调用(将两个维度变化的功能组合起来)
class BridgeActivity : BaseActivity(), ItemClickListener {
    private val studyContent = arrayOf("采摘苹果","采摘香蕉","采摘桔子")
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_common_content)
        findViewById()
        setTiTle("桥接模式")
        setAdapterContent(studyContent,AdapterActivity@this,AdapterActivity@this)
    }

    override fun itemClick(position: Int) {
        var bag:BagAbstract? = null
        when(position){
            0->{
                bag = BigBag()
            }
            1->{
                bag = MediumBag()
            }
            2->{
                bag = SmallBag()
            }
        }
        bag?.pick()

    }

}